import { ElMessage } from 'element-plus';
import { onBeforeMount, ref ,defineComponent,toRefs, watchEffect } from 'vue';
import { getNoteList } from "@/api/home";

/**
 * 字典hook
 * by Bing.Chan
 * @param dicTypeList =字典类型数组
 * @returns
 */
export function useNote() {
    let useNoteList = ref([]);
    //获取字典方法
    async function initNoteList() {
        let res = await getNoteList({});
        if (res.status == 0) {
            useNoteList.value = res.data
        }
    }

    onBeforeMount(() => {
        //debugger
        const token = sessionStorage.getItem("token");
        if (token) {
            initNoteList();
        }
    });

    return {
        useNoteList,
    };
}
